#ifndef MAINWINDOW_HPP
#define MAINWINDOW_HPP

#include <QtGui>
#include <QAction>
#include <QMenu>
//#include <QPlainTextEdit>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QListWidget>
#include <QPushButton>
#include <QMainWindow>
#include "ascii_art.hpp"
#include "genetic.hpp"

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow();
    ~MainWindow();

protected:
    void closeEvent(QCloseEvent *event);

private slots:
    void newFile();
    void open();
    bool save();
    bool saveAs();
    void zoomIn();
    void zoomOut();
    void normalSize();
    void fitToWindow();
    void print();
    void about();
    void createGenetics();
    //void documentWasModified();

private:
    void createActions();
    void createMenus();
    void createToolBars();
    void createStatusBar();
    void readSettings();
    void writeSettings();
    bool maybeSave();
    void updateActions();
    //////void loadFile(const QString &fileName);
    bool saveFile(const QString &fileName);
    void setCurrentFile(const QString &fileName);
    QString strippedName(const QString &fullFileName);
    void scaleImage(double factor);
    void adjustScrollBar(QScrollBar *scrollBar, double factor);

    QWidget *centralWidget;
    QGraphicsView *contentView;
    QGraphicsScene *contentScene;
    QListWidget *imagePanel;
    QString curFile;

    QMenu *fileMenu;
    QMenu *editMenu;
    QMenu *viewMenu;
    QMenu *helpMenu;
    QToolBar *fileToolBar;
    QToolBar *editToolBar;
    QToolBar *viewToolBar;
    QToolBar *graphicsToolBar;
    QToolBar *videoToolBar;
    QAction *newAct;
    QAction *openAct;
    QAction *saveAct;
    QAction *saveAsAct;
    QAction *printAct;
    QAction *exitAct;
    QAction *zoomInAct;
    QAction *zoomOutAct;
    QAction *normalSizeAct;
    QAction *fitToWindowAct;
    QAction *cutAct;
    QAction *copyAct;
    QAction *pasteAct;
    QAction *actToASCIIAct;
    QAction *videoFromThisAct;
    QAction *generateNewAct;
    QAction *aboutAct;
    QAction *aboutQtAct;

    QPushButton *generateChildsBtn;
    QPushButton *addChildBtn;

    QHBoxLayout *mainLayout;
    QVBoxLayout *panelLayout;
    //QVBoxLayout *contentLayout;
    //QLabel *imageLabel;
    //QScrollArea *scrollArea;
    double scaleFactor;
    #ifndef QT_NO_PRINTER
    QPrinter printer;
    #endif
};

#endif
